#include <bits/stdc++.h>

#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

template<class T>inline void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T>inline void chkmx(T &x, T y) { if (y > x) x = y; }

using namespace std;

namespace sub {

const int maxn = 150010;

int n, m, a, b;
ll dis[maxn][2];
vector<int> e[maxn];
priority_queue<pair<ll, pii>> q;

void work() {
  rep (i, 1, m) {
    int u, v;
    cin >> u >> v;
    e[u].emplace_back(v);
    e[v].emplace_back(u);
  }
  rep (i, 1, n) rep (j, 0, 1) dis[i][j] = 5e17;
  dis[1][0] = 0, q.emplace(0, pii(1, 0));
  while (!q.empty()) {
    ll cd = -q.top().fi;
    int u = q.top().se.fi, op = q.top().se.se;
    q.pop();
    if (cd != dis[u][op]) continue;
    for (int v : e[u]) {
      if (!op) {
        if (dis[u][0] + a < dis[v][0]) {
          dis[v][0] = dis[u][0] + a;
          q.emplace(-dis[v][0], pii(v, 0));
        }
        if (dis[u][0] < dis[v][1]) {
          dis[v][1] = dis[u][0];
          q.emplace(-dis[v][1], pii(v, 1));
        }
      } else {
        if (dis[u][1] + b < dis[v][0]) {
          dis[v][0] = dis[u][1] + b;
          q.emplace(-dis[v][0], pii(v, 0));
        }
      }
    }
  }
  rep (i, 2, n) cout << dis[i][0] << '\n';
}

}

const int maxn = 150010;
const int maxm = 10000010;
const ll inf = 5e17;

int n, m, tot, a, b, f[maxn], g[maxn], vis[maxn], used[maxn];
ll ans[maxn];
vector<int> e[maxn];
vector<int> s[maxn];
queue<int> q;

int main() {
  freopen("edge.in", "r", stdin);
  freopen("edge.out", "w", stdout);
  cin.tie(nullptr) -> ios::sync_with_stdio(false);
  cin >> n >> m >> a >> b;
  if (a < b) {
    sub::n = n, sub::m = m, sub::a = a, sub::b = b;
    return sub::work(), 0;
  }
  rep (i, 1, m) {
    int u, v;
    cin >> u >> v;
    e[u].emplace_back(v);
    e[v].emplace_back(u);
    s[u].emplace_back(v);
    s[v].emplace_back(u);
  }
  rep (i, 1, n) f[i] = 1e9, ans[i] = inf;
  f[1] = 0, q.emplace(1);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : e[u]) {
      if (f[u] + 1 < f[v]) {
        f[v] = f[u] + 1;
        q.emplace(v);
      }
    }
  }
  rep (i, 1, n) chkmn(ans[i], 1ll * b * (f[i] / 2) + a * (f[i] & 1));
  rep (i, 1, n) g[i] = 1e9;
  g[1] = 0, q.emplace(1);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : e[u]) vis[v] = u;
    vector<int> nd(0);
    for (int v : e[u]) {
      vector<int> ns;
      for (int w : s[v]) {
        if (!used[w]) ns.emplace_back(w);
        if (vis[w] == u) continue;
        if (g[u] + 1 < g[w]) {
          g[w] = g[u] + 1, q.emplace(w);
          nd.emplace_back(w);
        }
      }
      s[v] = ns;
    }
    for (int w : nd) used[w] = 1;
  }
  rep (i, 1, n) if (g[i] != 1e9) chkmn(ans[i], 1ll * g[i] * b);
  rep (i, 2, n) cout << ans[i] << '\n';
}